tree.io.formats.xml = {}

tree.io.formats.xml.dump = (data) ->
    serializer = new XMLSerializer
    return serializer.serializeToString data

tree.io.formats.xml.load = (data) ->
    parser = new DOMParser
    return parser.parseFromString data, 'text/xml'


###
give two filenames to this file
###
tree.io.formats.xml.applyXSLT = (xml, xslt) ->
    args = 
    {
        method:tree.io.ajax.REQUEST_METHODS.GET,
        async: false,
        type: tree.io.ajax.DATA_FORMAT.xml
    }
    xml = tree.io.ajax.xhr xml, args
    xlst = tree.io.ajax.xhr xslt, args
    xsltProcessor = new XSLTProcessor
    xsltProcessor.importStylesheet xslt
    result = xsltProcessor.transformToFragment xml,document
    return result
